import axios from 'axios';
import React, { useEffect, useState } from 'react';
import { history } from 'umi';
import '../css/cai.css';

export default function cai() {
  const [list, setlist] = useState([]);
  // 获取数据
  const datalist = async () => {
    const { data } = await axios.get('http://localhost:3000/yrt/datalist');
    setlist(data.data);
  };

  useEffect(() => {
    datalist();
  }, []);

  const chageng = () => {
    history.push('');
  };

  return (
    <div className="apps">
      {list.map((item) => (
        <div key={item._id} className="neixun">
          <div className="buju">
            <div className="imgpai">
              <img src={item.img} alt="" />
            </div>
            <p>{item.jinbi}币</p>
            <s>{item.jinbinum}</s>
          </div>
        </div>
      ))}
      <div className="chankan">
        <p onClick={chageng}>查看更多</p>
      </div>
    </div>
  );
}
